package com.study.ju.util.http;

/**
 * @author 陈涛
 * @description:
 * @Date 2018/6/14 9:41
 */
public enum ExceptionEnum {


    HTTP_REQ_EXCEPTION("50006","发送请求失败"),
    NOT_FOUND("50008","没有找到相应的http请求，请检查请求入参"),
    PARA_NULL_EXCETION("50007");


    private String code;
    private String msg;

    ExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    ExceptionEnum(String code){
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static ExceptionEnum getExceptionEnum(String code) {
        for (ExceptionEnum exceptionEnum : ExceptionEnum.values()) {
            if (exceptionEnum.getCode().equals(code)) {
                return exceptionEnum;
            }
        }
        return null;
    }

}
